package com.shop.trade.api.api;

import com.shop.common.model.param.trade.OrderBaseInput;
import com.shop.common.model.param.trade.OrderDetailInput;
import com.shop.common.util.excption.UserNotFoundException;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 *
 * @author zhoulk
 * @date: 2019年04月05日  18:38
 */
@RequestMapping("/trade")
public interface IOrderApi {

    @PostMapping(value = "/orders")
    String initOrder(@RequestBody Map<String, Integer> map, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.initOrderForShopCart
     * @Description //从购物车创建订单
     *
     * @param: map
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/11 16:51
     *
     **/
    @PostMapping(value = "/order/shopcart")
    String initOrderForShopCart(@RequestBody Map<String, List<Integer>> map, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.qryOrders
     * @Description //TODO 查询订单列表
     *
     * @param: orderBaseInput
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/11 22:29
     *
     **/
    @GetMapping(value = "/order/orders")
    String qryOrders(OrderBaseInput orderBaseInput, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.saveOrders
     * @Description //TODO 提交订单
     *
     * @param: inParam
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/12 18:09
     *
     **/
    @PostMapping(value = "/order/save")
    String saveOrders(@RequestBody Map<String, List<OrderBaseInput>> inParam, boolean integral, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.deleteOrder
     * @Description //删除订单
     *
     * @param: orderId
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:31
     *
     **/
    @DeleteMapping(value = "/order")
    String deleteOrder(String orderId, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.modeOrder
     * @Description //TODO 修改订单
     *
     * @param: orderBaseInput
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:31
     *
     **/
    @PutMapping(value = "/order")
    String modeOrder(@RequestBody OrderBaseInput orderBaseInput, HttpServletRequest request);

    /**
     * @Function com.shop.trade.api.api.IOrderApi.cancelOrder
     * @Description //TODO 取消订单
     *
     * @param: inParam
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:31
     *
     **/
    @PostMapping(value = "/order/cancel")
    String cancelOrder(@RequestBody Map<String, String> inParam, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.validateOrder
     * @Description //TODO 订单校验
     *
     * @param: orderId
     * @param: state
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:31
     *
     **/
    @GetMapping(value = "/order/validate")
    String validateOrder(Integer orderId, Integer state);

    /**
     * @Function com.shop.trade.api.api.IOrderApi.checkOrder
     * @Description //TODO 审核订单
     *
     * @param: idStr
     * @param: type
     * @param: comment
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:38
     *
     **/
    @PutMapping(value = "/order/check")
    String checkOrder(String idStr, String state, String type, String comment, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.sendOrder
     * @Description //TODO 订单发货
     *
     * @param: idStr
     * @param: expressNo
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 15:38
     *
     **/
    @PutMapping(value = "/order/express")
    String sendOrder(String idStr, String expressNo, HttpServletRequest request) throws UserNotFoundException;

    /**
     * @Function com.shop.trade.api.api.IOrderApi.endOrder
     * @Description //TODO 确认收货
     *
     * @param: input
     * @param: request
     * @return java.lang.String
     * @errorCode //TODO
     *
     * @Author zhoulk
     * @Date 2019/4/20 19:06
     *
     **/
    @PutMapping(value = "/order/finish")
    String endOrder(@RequestBody OrderBaseInput input, HttpServletRequest request) throws UserNotFoundException;

    @GetMapping(value = "/order/detail")
    String qryOrderDetail(OrderDetailInput orderDetailInput, HttpServletRequest request) throws UserNotFoundException;

    @GetMapping(value = "/order/detail/count/{userId}")
    String qryOrderItemCount(@PathVariable("userId") Integer userId);

}
